ShowDialog 6,5003,3001,12,line 2 of theResult,FALSE
put the result into theResult
--ΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇó Notes on Type 6 of ShowDialog ΓÇóΓÇóΓÇóΓÇóΓÇóΓÇóΓÇó
-- If the user clicked the TOPICS button (DITL item #7) the
-- result will be TRUE.
-- If the user clicked the CANCEL button (DITL item #1) the
-- result will be FALSE.
-- Use the TRUE/FALSE values to respond to the dialog (as in
-- this example).
if theResult is FALSE then exit repeat
end repeat
end mouseUp
-- part 3 (field)
-- low flags: 80
-- high flags: 2007
-- rect: left=164 top=19 right=278 bottom=481
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 0
-- font id: 3
-- text size: 10
-- style flags: 0
-- line height: 13
-- part name: test
-- part 4 (button)
-- low flags: 80
-- high flags: A003
-- rect: left=405 top=266 right=288 bottom=440
-- title width / last selected line: 0
-- icon id / first selected line: 0 / 0
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: OK
----- HyperTalk script -----
on mouseUp
lock screen
hide me
hide cd pict
unlock screen with zoom in
end mouseUp
-- part 7 (button)
-- low flags: 00
-- high flags: 0000
-- rect: left=11 top=4 right=64 bottom=78
-- title width / last selected line: 0
-- icon id / first selected line: 529 / 529
-- text alignment: 1
-- font id: 0
-- text size: 12
-- style flags: 0
-- line height: 16
-- part name: SD
-- part contents for background part 21
----- text -----
ShowDialog XCMD Type 7
-- part contents for background part 30
----- text -----
19
-- part contents for background part 15
----- text -----
ShowDialog Type 7 parameters are:
ShowDialog 7,<DLOG resource ID>,<prompt string>,
<font>,<font size>,<list contents>,
<line number hilited>,<single select>,[<top coord>,
<left coord>]
where
7 is the type;
<DLOG resource ID> is the ID of the DLOG resource;
<prompt string> is a string of text that can appear in the dialog;
<font> is the font that the scrolling list will appear in;
<font size> is the font size that the scrolling list will appear in;
<list contents> is a return delimited variable or field that will make up the scrolling list;
<line number hilited> is the line of the scrolling list that will be hilited when the dialog is shown.
Pass "0" (that's a zero) if you want NO line initially hilited;
<single select> configures the scrolling list so that only one line can be selected at at time. If this parameter is "one" then only one line can be selected. If it is "many" then Shift-clicking will select multiple lines and Shift-click-dragging will select
"continuous" lines. This parameter must be in quotes in the parameter list.
The last two parameters are OPTIONAL. They set the top, left coordinates of the dialog. If these two parameters are omitted the dialog will be centered within the card window.
-- part contents for background part 17
----- text -----
ΓÇó Prompt String Font
The <prompt string> will always appear in Chicago 12 pt.
ΓÇó Scrolling List Font
If the font that you specify for the list isn't available, Chicago will be substituted.
If (for some reason) you specify 0 as the point size, 12 pt will be substituted.
ΓÇó Regular Buttons
ShowDialog Type 7 can have as many "regular" buttons as you want. ShowDialog will return the DITL item# of the button clicked as line 1 of the Result. If enter or return is typed, or the user double-clicks on a line in the scrolling field, line 1 of the result will contain the DITL item# of the default button (which is ALWAYS 1). If the user types command-period, line 1 of the result will ALWAYS contain DITL item# 2.
ΓÇó Static Text
The Dialog Manager allows you to have ONLY ONE font in a dialog. Any static text that you put in your DLOG template will appear in the same font (and size) as the list (I got around this restriction with the prompt string by hard coding its font attributes). So if you wish to have static text in your dialog that is NOT in the same font as the list, make this text in a "paint" program and add it to the DLOG template as a PICT.
ΓÇó The DLOG/DITL Template
In designing your DLOG/DITL template there are some things to keep in mind:
DITL item #1 is the OK button.
DITL item #2 is the CANCEL button.
DITL item #3 is the scrolling list. This must be a ENABLED useritem.
DITL item #4 is the prompt string. This MUST be a DISABLED useritem. If you don't want a prompt string, DITL item #4 can be anything else (Just pass "" in the <prompt string> parameter.)
DITL items #5 ... onward can be regular buttons, icons, PICTs, and static text.
ΓÇó The Scrolling List DITL Item
In constructing the useritem that will be the scrolling list:
The list will have a vertical scroll bar which will lie OUTSIDE the useritem and will be 15 pixels wide. So leave a 15 pixel-wide space TO THE RIGHT of useritem DITL #3 for the scroll bar (otherwise the scroll bar could overlap with something else you have placed in the DLOG template). • Click here to see. •
Just prior to displaying the dialog, ShowDialog calculates the line height of the list based on the ascent + decent + leading of the font that you have specified.
In order for the list to be displayed correctly, the vertical height of useritem DITL #3 must be an EXACT MULTIPLE of the line height of the list.
You don't have to worry about this yourself. ShowDialog takes a look at the dimensions of the useritem, and, if the vertical height is not EXACTLY a multiple of the line height, IT ADJUSTS THE VERTICAL HEIGHT OF THE USERITEM FOR YOU.
So, if you find that the rect of DISPLAYED list is slightly different from the one that you specified in your DLOG template, it is because the useritem was a little off in its dimensions. In other words, when you design your DLOG template, put the useritem approximately where you want it and ShowDialog will position it correctly.
The reason for all this is purely aesthetic.
• Show me. •
The result is a RETURN-delimited list:
Line 1: DITL item# of button clicked.
Line 2: comma-delimited list of lines from the scrolling list that were hilited:
first hilited line, second hilited line, third hilited line, etc.
If the user hits enter or return, or double-clicks on a line in the scrolling list, line 1 of the result will contain the DITL item# of the default button (which is ALWAYS 1). This is why DITL item# 1 should be OK.
If the user types command-period, line 1 of the result will contain 2 (DITL item# 2). This is why DITL item# 2 should ALWAYS be CANCEL.
The other "buttons" can be hot spots, if you like. Just put ENABLED useritems in your DLOG template. If you're going to associate these hot spots with a graphic in the dialog, remember that the hot spot useritems must lie "UNDER" the graphic PICT.
See "All PICT Dialogs" under "Special Notes" on the Special Dialogs Card for details on how to do this.
If you've been using versions of ShowDialog older than 1.6, please note that the PARAMETERS AND RESULT for Type 7 have changed to increase its functionality.
You can now configure the scrolling list so that only one line can be selected at a time.
The result is now RETURN-delimited. Line 1 of the result is the DITL item# of the button clicked. Line 2 of the result is a comma-delimited list of the lines from the scrolling list that were hilited.
ShowDialog Type 7 displays a dialog that contains a scrolling list. Use this type of dialog in situations where the user must select from a list of items.
Type 7 can contain icons, PICTs, static text, and any number of "regular" buttons in addition to the scrolling list.
ΓÇóFunction of the Scrolling List
The scrolling list can be configured so that only one line can be selected at a time, or can be configured so that Shift-clicking will select multiple lines and Shift-click-dragging will select "continuous" lines.
Dragging the mouse above or below the list will scroll it in that direction.
Double clicking on a line or hitting return or enter is the same as clicking the OK button.
Typing command-period is the same as clicking the CANCEL button.
The scrolling list is subject to full keyboard control and will respond to "hot keys":
ΓÇó To scroll the list up:
press the cursor up button
press the page up button
press the "less than" (<) button (no need to shift)
ΓÇó To scroll the list down:
press the cursor down button
press the page down button
press the "greater than" button (no need to shift)
ΓÇó To scroll list to the top:
press the home button
ΓÇó To scroll list to the end:
press the end button
ΓÇó To directly to a line ("hot keys"):
The list will scroll to a line that begins with the     letter that you type. This function is only useful,     of course, if you alphabetize your list items.
There is no limit to the number of lines that a list can contain. The more lines in the list, the longer it will take before the dialog is displayed. ShowDialog displays the watch cursor while it constructs the list
(although this time is negligible for lists of any reasonable length).